package org.incubator;

/**
 * Generator which always returns the same constant value.
 * 
 * @author Jeroen van Schagen
 * @since 27-04-2011
 *
 * @param <T> type of constant being returned
 */
public class ConstantGenerator<T> implements Generator<T> {
    private final T constant;

    /**
     * Construct a new {@link ConstantGenerator}.
     * @param constant the constant that should be returned
     */
    public ConstantGenerator(T constant) {
        this.constant = constant;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public T generate() {
        return constant;
    }

}
